//
//  SRPageTrackTapView.m
//  StoryShow
//
//  Created by CyonLeuMBP on 2017/4/18.
//  Copyright © 2017年 qudiandu.cn. All rights reserved.
//

#import "SRBookPageTrackTapView.h"

@implementation SRBookPageTrackTapView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
    }
    
    return self;
}

- (void)setupView {
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapView:)];
    [self addGestureRecognizer:tapGesture];
    
    self.layer.borderColor = [FZStyleSheet currentStyleSheet].color_7.CGColor;
    self.layer.borderWidth = 1;
    self.borderStyle = SRPageTrackBorderStyleNone;
}

- (void)onTapView:(id)sender {
    self.borderStyle = SRPageTrackBorderStyleClicked;
    
    if (self.touchTrackViewBlock) {
        self.touchTrackViewBlock(self, self.trackModel, self.index);
    }
}

- (void)setBorderStyle:(SRPageTrackBorderStyle)borderStyle {
    _borderStyle = borderStyle;
    if (borderStyle == SRPageTrackBorderStyleClicked) {
            //点击状态
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
        self.layer.borderColor = [FZStyleSheet currentStyleSheet].color_7.CGColor;
        self.layer.borderWidth = 1;
    } else if (borderStyle == SRPageTrackBorderStyleLightBorder){
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
        self.layer.borderColor = [FZStyleSheet currentStyleSheet].color_7.CGColor;
        self.layer.borderWidth = 1;
    }
    else {
        self.backgroundColor = [UIColor clearColor];
        self.layer.borderColor = [UIColor clearColor].CGColor;
        self.layer.borderWidth = 0;
    }
}



@end
